<script>
	$(function(){
		$('[class^=status]').click(function(){
			var status = $(this).attr('class');
			if(status == 'status-all'){
				$('.list tbody tr').show();
			}else{
				$('.list tbody tr').hide();
				$('.list .'+status).parent().parent().show();
			}
		});
	});
</script>
<h1><?php echo $fund['name'] ?></h1>
<ul id="breadcrumb">
	<li>ภาพรวมการส่งข้อมูล</li>		
</ul>
<div id="content">
	<div class="search">
	<form aaction="child" method="get">
		<label>ปีงบประมาณ </label><?php echo form_dropdown('year', get_year_option('2550'),(!empty($_GET['year']))?$_GET['year']:date('Y')+543); ?>
		&nbsp;&nbsp;<label>เดือน </label><?php echo form_dropdown('month', get_month(),(!empty($_GET['month']))?$_GET['month']:date('m'),''); ?>
		<input type="submit" value="<?php echo lang('search'); ?>" class="button" />
	</form>
	</div>

	<div class="info">
			<a class="status-all" href="javascript:;">หน่วยงาน ทั้งหมด(<?php echo count($result) ?>)</a>
			&nbsp;&nbsp;<a class="status-0" href="javascript:;">อยู่ระหว่างดำเนินการ(<?php echo (count($result) - ($status_1 + $status_2 + $status_3) ) ?>)</a>
			&nbsp;&nbsp;<a class="status-1" href="javascript:;">รอการตรวจสอบ(<?php echo $status_1 ?>)</a>
			&nbsp;&nbsp;<a class="status-3" href="javascript:;">แก้ไข(<?php echo $status_3 ?>)</a>
			&nbsp;&nbsp;<a class="status-2" href="javascript:;">เรียบร้อย(<?php echo $status_2 ?>)</a>
		</div>
<table class="list">
	<thead>
	<tr>
		<th>หน่วยงาน</th>
		<th style="width:100px">ล็อค</th>
		<th width="600"></th>
		<th style="width:200px">สถานะ</th>
		<th style="width:180px"></th>
	</tr>
	</thead>
	<tbody>
	<? foreach($result as $key => $item): ?>
	<tr <?php echo cycle($key) ?>>
		<td><?php echo $item['name'] ?></td>
		<td class="center"><a href="setting/toggle/<?php echo $fund_id ?>/<?php echo $item['id'] ?>"/><img src="themes/fund/images/icon/<?php echo (($item['is_lock']=='')||($item['is_lock']==1))?'lock.gif':'unlock.png' ?>" /></a></td>
		<td class="center">
			<?php echo anchor('voucher/index/'.$fund_id.'?year='.($year+543).'&month='.$month.'&agency_id='.$item['id'],'<span class="icon_text clipboard"></span>ใบสำคัญการลงบัญชี','class="button"') ?>
			<?php echo anchor('voucher/trial/month/'.$fund_id.'?year='.($year+543).'&month='.$month.'&agency_id='.$item['id'],'<span class="icon_text table_money"></span>งบทดลอง','class="button"') ?>
			<?php echo anchor('voucher/receive_paid/'.$fund_id.'?year='.($year+543).'&month='.$month.'&agency_id='.$item['id'],'<span class="icon_text coin"></span>รายงานรับจ่ายเงิน','class="button"') ?>
			<?php echo anchor('voucher/banking_balance/'.$fund_id.'?year='.($year+543).'&month='.$month.'&agency_id='.$item['id'],'<span class="icon_text bank"></span>งบพิสูจน์ยอดเงินฝาก','class="button"') ?>
		</td>
		<td class="center">
		<?php echo Fund::status($item['status'], TRUE); ?>
		</td>
		
		<td class="center">
			<?php if($item['status']==1): ?>
			<a class="button" href="setting/approve/<?php echo $item['status_id'] ?>"><span class="icon_text accept"></span>ผ่าน</a> <a class="button" href="setting/fail/<?php echo $item['status_id'] ?>"><span class="icon_text cancel"></span>ไม่ผ่าน</a>
			<?php endif; ?>
		</td>
	</tr>
	</tbody>
	<? endforeach; ?>
</table>
</div>